/**
 * 系统设置相关类型定义
 * 注意：主要类型定义已迁移到 @/config/unified-settings.ts
 * 此文件保留向后兼容的类型别名
 */

import type { UnifiedSettings, SettingsCategory } from '@/config/unified-settings'

// 重新导出统一设置类型
export type {
  UnifiedSettings as AppSettings,
  SettingsCategory
} from '@/config/unified-settings'

// 为本地使用定义 AppSettings 类型别名
type AppSettings = UnifiedSettings

// 向后兼容的类型别名
export type ThemeSettings = UnifiedSettings['theme']
export type InterfaceSettings = UnifiedSettings['interface']
export type LanguageSettings = UnifiedSettings['language']
export type NotificationSettings = UnifiedSettings['notification']
export type SecuritySettings = UnifiedSettings['security']
export type PerformanceSettings = UnifiedSettings['performance']
export type SystemSettings = UnifiedSettings['system']
export type DataSettings = UnifiedSettings['data']
export type IntegrationSettings = UnifiedSettings['integration']

// 注意：SettingsCategory 已从 @/config/unified-settings.ts 重新导出

// 设置项
export interface SettingsItem {
  key: string
  title: string
  description: string
  type: 'string' | 'number' | 'boolean' | 'select' | 'color' | 'file' | 'textarea'
  value: any
  defaultValue: any
  options?: Array<{ label: string; value: any }>
  min?: number
  max?: number
  step?: number
  placeholder?: string
  required?: boolean
  disabled?: boolean
  category: string
  order: number
}

// 设置验证规则
export interface SettingsValidation {
  [key: string]: {
    required?: boolean
    min?: number
    max?: number
    pattern?: string
    custom?: (value: any) => boolean | string
  }
}

// 设置变更记录
export interface SettingsChangeLog {
  id: string
  key: string
  oldValue: any
  newValue: any
  changedBy: string
  changedAt: string
  reason?: string
}

// 设置导入导出
export interface SettingsExport {
  version: string
  timestamp: string
  settings: Partial<AppSettings>
  metadata: {
    exportedBy: string
    exportedAt: string
    systemVersion: string
  }
}

// 设置模板
export interface SettingsTemplate {
  id: string
  name: string
  description: string
  category: string
  settings: Partial<AppSettings>
  isDefault: boolean
  isPublic: boolean
  createdBy: string
  createdAt: string
  updatedAt: string
}
